require 'rake'
require 'rubygems'

require 'rake/rdoctask'

# Gem building
begin
  require 'jeweler'
  Jeweler::Tasks.new do |s|
    s.name = "i_helpers"
    s.summary = "Useful Rails helpers"
    s.email = "maciej@inszy.org"
    s.homepage = "http://github.com/maciej/i_helpers"
    s.description = "Useful Rails helpers."
    s.authors = ["Maciej Bilas"]
    s.rubyforge_project = %q{i_helpers}
    
    # Files
    s.files = Dir.glob("{spec,lib}/**/*") +
      %w(MIT-LICENSE, README) - ["spec/debug.log"]
  end
rescue LoadError
  puts "Jeweler not available. Install it with: sudo gem install jeweler"
end

# Load the specs
require 'spec/rake/spectask'
desc 'Run the specs'
Spec::Rake::SpecTask.new(:spec) do |t|
  t.libs << 'lib'
  t.pattern = 'spec/*_spec.rb'
  t.verbose = true
  t.spec_opts = ['--colour --format progress --loadby mtime --reverse']
end

desc 'Generate documentation for the i_helpers plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
  rdoc.rdoc_dir = 'rdoc'
  rdoc.title    = 'IHelpers'
  rdoc.options << '--line-numbers' << '--inline-source'
  rdoc.rdoc_files.include('README')
  rdoc.rdoc_files.include('lib/**/*.rb')
end

desc 'Default: run specs.'
task :default => :spec